<?php

namespace slinks\common\matcher;

/**
 * Multiple matches can be And'd together. 
 * 
 * @author Navid Mitchell
 *
 */
class AndMatcher extends AbstractMultiMatcher {

    /**
     * Called to determine if a given canidate "Matches"
     * 
     * @param mixed $canidate
     * @return bool true if the canidate "Matches" false if not.
     */
    public function matches($canidate) {
        $ret = true;
        foreach ($this->matchers as $matcher) {
            if (!$matcher->matches($canidate)) {
                $ret = false;
                break;
            }
        }
        return $ret;
    }

}
